package com.project.util;

import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

/**
 * @Title: IntegerChange
 * @Package: com.project.util
 * @Description:
 * @Author: Liang-Xie
 * @Date: 2022/6/30 - 16:51
 */
@SuppressWarnings("all")
@Component
public class IntegerChange implements Converter<String,Integer> {
    @Override
    public Integer convert(String source) {
        if (source!=null&&source.matches("\\d+")){
            return Integer.parseInt(source);
        }
        return null;
    }
}
